﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
namespace Util
{
    public class LogUtil
    {
        public static Logger m_log = LogManager.GetCurrentClassLogger();
        //Info log
        public static void Info(string info)
        {
            LogUtil.m_log.Info(info);
        }
        public static void InfoException(Exception ex)
        {
            LogUtil.m_log.InfoException(ex);
        }
        //Debug log
        public static void Degug(string debug)
        {
            LogUtil.m_log.Debug(debug);
        }
        public static void DebugException(Exception ex)
        {
            LogUtil.m_log.DebugException(ex);
        }
        //Error log
        public static void Error(string error)
        {
            LogUtil.m_log.Error(error);
        }
        public static void ErrorException(Exception ex)
        {
            LogUtil.m_log.Error(ex);
        }
        //Fatal log
        public static void Fatal(string fatal)
        {
            LogUtil.m_log.Fatal(fatal);
        }
        public static void FatalException(Exception ex)
        {
            LogUtil.m_log.FatalException(ex);
        }
        ////Log log
        //public static void Log(string log)
        //{
        //    LogUtil.m_log.Log(log);
        //}
        //public static void LogException(Exception ex)
        //{
        //    LogUtil.m_log.LogException(ex);
        //}
        //Warn Log
        public static void Warn(string warn)
        {
            LogUtil.m_log.Warn(warn);
        }
        public static void WarnException(Exception ex)
        {
            LogUtil.m_log.WarnException(ex);
        }
    }
    /// <summary>
    /// extension nlog.dll
    /// </summary>
    public static class NLogExtension
    {
        //info extension
        public static void InfoException(this Logger log, Exception ex)
        {
            log.InfoException(ex.StackTrace, ex);
        }
        //debug extension
        public static void DebugException(this Logger log, Exception ex)
        {
            log.DebugException(ex.StackTrace, ex);
        }
        //error extension
        public static void ErrorException(this Logger log, Exception ex)
        {
            log.ErrorException(ex.StackTrace, ex);
        }
        //fatal extension
        public static void FatalException(this Logger log, Exception ex)
        {
            log.FatalException(ex.StackTrace, ex);

        }
        ////log extension
        //public static void LogException(this Logger log, Exception ex)
        //{
        //    log.LogException(ex.StackTrace,ex);
        //}
        //warn extension
        public static void WarnException(this Logger log, Exception ex)
        {

            log.WarnException(ex.StackTrace, ex);
        }
    }
}